// UserProfile.cs created with MonoDevelop
// User: kev at 23:03 11/10/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//

using System;
using System.Net;
//using System.Security.Cryptography;
using System.Collections.Generic;

namespace GtkTest
{
    
    public class UserProfile
    {
        string                              m_strId;             // This will be what ever the user enters concatenated with the users machine/IP
        string                              m_strFriendlyName;
        string                              m_strGroupId;
        string                              m_strHostName;
        IPAddress                           m_IPAddress;
        byte[]                              m_BuddyIconHash;
        CurrentState                        m_eCurrentState;
        Dictionary<CurrentState, string>    m_strCurrentState;

        public enum CurrentState
        {
            Offline,
            Online,
            Away,
            Busy,
            OnPhone,
            AtLunch,
            Typing
        }

        public string UserId
        {
            get
            {
                return m_strId;
            }
            set
            {
                m_strId = value;
            }
        }

        public string FriendlyName
        {
            get
            {
                return m_strFriendlyName;
            }
            set
            {
                m_strFriendlyName = value;
            }
        }

        public string GroupId
        {
            get
            {
                return m_strGroupId;
            }
            set
            {
                m_strGroupId = value;
            }
        }

        public string MachineName
        {
            get
            {
                return m_strHostName;
            }
            set
            {
                m_strHostName = value;
            }
        }

        public IPAddress UserIP
        {
            get
            {
                return m_IPAddress;
            }
            set
            {
                m_IPAddress = value;
            }
        }

        public byte[] BuddyIconHash
        {
            get
            {
                return m_BuddyIconHash;
            }
            set
            {
                m_BuddyIconHash = value;
            }
        }

        public CurrentState State
        {
            get
            {
                return m_eCurrentState;
            }
            set
            {
                m_eCurrentState = value;
            }
        }

        
        /// <summary>
        /// Class Constructor
        /// </summary>
        public UserProfile()
        {
            // initialse the members
            m_strId = "";
            m_strFriendlyName = "";
            m_strGroupId = "";
            m_strHostName = Dns.GetHostName();
            Console.WriteLine("Getting IP Address for localhost {0}", m_strHostName);
            m_IPAddress = Dns.GetHostEntry(m_strHostName).AddressList[0];
            m_eCurrentState = CurrentState.Offline;
            m_BuddyIconHash = null;

            // Create the CurrentState string map
            m_strCurrentState = new Dictionary<CurrentState,string>();
            m_strCurrentState.Add(CurrentState.Offline,     "Offline");
            m_strCurrentState.Add(CurrentState.Online,      "Online");
            m_strCurrentState.Add(CurrentState.OnPhone,     "On the phone");
            m_strCurrentState.Add(CurrentState.Busy,        "Busy");
            m_strCurrentState.Add(CurrentState.Away,        "Away");
            m_strCurrentState.Add(CurrentState.AtLunch,     "At lunch");
            m_strCurrentState.Add(CurrentState.Typing,      "Typing");
        }

        public string StateString(CurrentState eState)
        {
            return m_strCurrentState[eState];
        }

    }
}